﻿@inherits Vowei.Web.G18nWebViewPage<Vowei.Core.Models.Requirement>
@using System.Web.Mvc.Html 
@using Vowei.Core.Models
@using Vowei.Web.Helpers
@using Vowei.Data.Models

@{
    ViewBag.Title = Model.Title;    
}
<div>
  <h2>@Model.Title</h2>
  <fieldset>
    <legend>@string.Format(T("需求 #{0} 详细信息"), Model.ID)</legend>
    <table class="properties">
      <tr>
        <th>@T(r => r.AssignedTo)</th>
        <td>@Model.AssignedTo</td>
        <th>@T(r => r.Reporter)</th>
        <td>@Model.Reporter</td>
      </tr>
      <tr>
        <th>@T(r => r.BusinessValue)</th>
        <td>@Model.BusinessValue</td>
        <th>@T(r => r.BelongsToMilestone)</th>
        <td>
           @if (Model.BelongsToMilestone is Project)
           {
               <a href="/Project/Details/@Model.BelongsToMilestone.ID">@Model.BelongsToMilestone.Title</a>
           }
           else if (Model.BelongsToMilestone is Milestone)
           {
               <a href="/Milestone/Details/@Model.BelongsToMilestone.ID">@Model.BelongsToMilestone.Title</a>
           }
        </td>
      </tr>
      <tr>
        <th>@T(r => r.OpenDate)</th>
        <td>@Model.OpenDate</td>
        <th>@T(r => r.ClosedDate)</th>
        <td>@Model.ClosedDate</td>
      </tr>
      <tr>
        <th>@T(r => r.Status)</th>
        <td colspan="3">
           @Model.Status
        </td>
      </tr>
      @{
          var requirement = ViewData["UpRequirement"] as Requirement;
       }
       
       @if (requirement != null)
       {
       <tr>
         <th>@T("父级需求")</th>
         <td colspan="3">
            <a href="/Requirement/Details/@requirement.ID">@requirement.Title</a>
         </td>
       </tr>
       }
    </table>	
    <div class="description">
        @Html.Raw(Model.Description)
    </div>
    <p>
        @Html.ActionLink(T("编辑需求"), "Edit", new { id = Model.ID }) |
        <a href="/Requirement/Index/?pid=@Model.BelongsToMilestone.ID">@T("返回需求列表")</a> |
        @Html.ActionLink(T("所有子需求与任务"), "AllTickets", new { id = Model.ID }) |
        @{
            var url = string.Format("http://{0}:{1}/Requirement/AllTickets/{2}", Request.Url.Host, Request.Url.Port, Model.ID);
        }
        <a href="/Ticket/ExportToExcel/?title=@Server.UrlEncode(string.Format(T("[{0}]的所有子需求与任务"), Model.Title))&reffer=@Server.UrlEncode(url)">@T("导出子任务到Excel")</a> |
        <a href="/Wizard/ImportRequirementTasks/@Model.ID">@T("从Excel导入任务")</a>
    </p>
    <div class="references_container">
        <h2>@T("任务")</h2>
        <ul class="references">
        @foreach (var ticket in Model.Children) {
           <li class="reference">
              <strong>@T("名称：")</strong>(<a href="/Ticket/Details/@ticket.ID">@ticket.ID</a>): @ticket.Title
           </li>
         }
        </ul>
    </div>
  </fieldset>
</div>

@Html.Partial("_CommentPartial", Model)